// 橘子小说 - 统一弹窗样式
// ================================

// 弹窗动画
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) translateY(0);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }
  70% {
    transform: translate(-50%, -50%) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

// 基础弹窗覆盖层
.dialog-overlay, .payment-overlay, .modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
  
  &.mobile {
    padding: 20px;
  }
}

// 基础弹窗容器
.dialog, .payment-dialog, .result-dialog, .modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(145deg, #ffffff, #f8f9fa);
  border-radius: 20px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  overflow: hidden;
  min-width: 400px;
  max-width: 90vw;
  max-height: 90vh;
  animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  
  // 橘子色装饰边框
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    background-size: 200px 100%;
    animation: shimmer 2s infinite;
  }
  
  &.large {
    min-width: 600px;
    min-height: 500px;
  }
  
  &.small {
    min-width: 300px;
  }
  
  // 移动端适配
  @media (max-width: 768px) {
    min-width: 320px;
    max-width: calc(100vw - 40px);
    margin: 20px;
    transform: translate(-50%, -50%) scale(0.95);
    
    &.large {
      min-width: 300px;
      min-height: auto;
    }
  }
}

// 弹窗头部
.dialog-header {
  padding: 24px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 107, 53, 0.1);
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.05), rgba(255, 165, 0, 0.03));
  
  h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  
  .close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 107, 53, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--primary-color);
    transition: all 0.3s ease;
    
    &:hover {
      background: var(--primary-color);
      color: white;
      transform: rotate(90deg);
    }
    
    svg {
      width: 16px;
      height: 16px;
    }
  }
}

// 弹窗内容
.dialog-content {
  padding: 24px;
  color: #333;
  line-height: 1.6;
  
  &.scrollable {
    max-height: 400px;
    overflow-y: auto;
    
    &::-webkit-scrollbar {
      width: 6px;
    }
    
    &::-webkit-scrollbar-track {
      background: rgba(255, 107, 53, 0.1);
      border-radius: 3px;
    }
    
    &::-webkit-scrollbar-thumb {
      background: var(--primary-color);
      border-radius: 3px;
      
      &:hover {
        background: var(--primary-dark);
      }
    }
  }
}

// 弹窗底部按钮区域
.dialog-footer {
  padding: 16px 24px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-top: 1px solid rgba(255, 107, 53, 0.1);
  background: rgba(255, 107, 53, 0.02);
  
  .btn {
    padding: 10px 24px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    
    &::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 0;
      height: 0;
      background: rgba(255, 255, 255, 0.3);
      border-radius: 50%;
      transition: all 0.3s ease;
      transform: translate(-50%, -50%);
    }
    
    &:hover::before {
      width: 200px;
      height: 200px;
    }
    
    &.primary {
      background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
      color: white;
      box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
      
      &:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
      }
      
      &:active {
        transform: translateY(0);
      }
    }
    
    &.secondary {
      background: #f8f9fa;
      color: #666;
      border: 1px solid rgba(255, 107, 53, 0.2);
      
      &:hover {
        background: rgba(255, 107, 53, 0.1);
        color: var(--primary-color);
        border-color: var(--primary-color);
      }
    }
  }
}

// Toast 提示框样式
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10000;
  pointer-events: none;
  
  @media (max-width: 768px) {
    top: 60px;
    left: 20px;
    right: 20px;
  }
}

.toast {
  background: linear-gradient(135deg, #ffffff, #f8f9fa);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  animation: slideInRight 0.3s ease;
  
  // 左侧装饰条
  &::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
  }
  
  &.success::before {
    background: linear-gradient(135deg, #10b981, #059669);
  }
  
  &.error::before {
    background: linear-gradient(135deg, #ef4444, #dc2626);
  }
  
  &.warning::before {
    background: linear-gradient(135deg, #f59e0b, #d97706);
  }
  
  &.info::before {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  }
  
  .toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    
    svg {
      width: 16px;
      height: 16px;
    }
    
    &.success {
      background: rgba(16, 185, 129, 0.1);
      color: #10b981;
    }
    
    &.error {
      background: rgba(239, 68, 68, 0.1);
      color: #ef4444;
    }
    
    &.warning {
      background: rgba(245, 158, 11, 0.1);
      color: #f59e0b;
    }
    
    &.info {
      background: rgba(255, 107, 53, 0.1);
      color: var(--primary-color);
    }
  }
  
  .toast-content {
    flex: 1;
    
    .toast-title {
      font-weight: 600;
      color: #1a1a1a;
      margin-bottom: 2px;
      font-size: 14px;
    }
    
    .toast-message {
      color: #666;
      font-size: 13px;
      line-height: 1.4;
    }
  }
  
  .toast-close {
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    cursor: pointer;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    
    &:hover {
      background: rgba(0, 0, 0, 0.05);
      color: #666;
    }
    
    svg {
      width: 12px;
      height: 12px;
    }
  }
  
  @media (max-width: 768px) {
    min-width: auto;
    max-width: none;
    margin: 0 0 12px 0;
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

// 确认对话框样式
.confirm-dialog {
  text-align: center;
  
  .confirm-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(255, 165, 0, 0.05));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    
    svg {
      width: 32px;
      height: 32px;
      color: var(--primary-color);
    }
  }
  
  .confirm-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
  }
  
  .confirm-message {
    color: #666;
    line-height: 1.5;
    margin-bottom: 24px;
  }
}

// 支付相关弹窗特殊样式
.payment-dialog {
  .payment-header {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(255, 165, 0, 0.05));
    padding: 24px;
    border-bottom: 1px solid rgba(255, 107, 53, 0.1);
    
    .chapter-info h3 {
      background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }
    
    .price-info {
      display: flex;
      align-items: center;
      gap: 4px;
      margin-top: 8px;
      
      .price {
        font-size: 20px;
        font-weight: 700;
        color: var(--primary-color);
      }
      
      .currency {
        font-size: 14px;
        color: #666;
      }
    }
  }
}

// VIP相关弹窗样式
.vip-dialog {
  .vip-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    
    .vip-package {
      border: 2px solid rgba(255, 107, 53, 0.2);
      border-radius: 12px;
      padding: 20px;
      cursor: pointer;
      transition: all 0.3s ease;
      position: relative;
      
      &:hover {
        border-color: var(--primary-color);
        transform: translateY(-4px);
        box-shadow: 0 8px 25px rgba(255, 107, 53, 0.2);
      }
      
      &.popular {
        border-color: var(--primary-color);
        background: linear-gradient(135deg, rgba(255, 107, 53, 0.05), rgba(255, 165, 0, 0.02));
        
        .popular-badge {
          position: absolute;
          top: -8px;
          right: 16px;
          background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
          color: white;
          padding: 4px 12px;
          border-radius: 12px;
          font-size: 12px;
          font-weight: 600;
        }
      }
    }
  }
}

// 深色模式支持
@media (prefers-color-scheme: dark) {
  .dialog, .payment-dialog, .result-dialog, .modal {
    background: linear-gradient(145deg, #2a2a2a, #1f1f1f);
    color: #e0e0e0;
    
    .dialog-header {
      background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(255, 165, 0, 0.05));
      border-bottom-color: rgba(255, 107, 53, 0.2);
      
      h3 {
        color: #e0e0e0;
      }
    }
    
    .dialog-footer {
      background: rgba(255, 107, 53, 0.05);
      border-top-color: rgba(255, 107, 53, 0.2);
    }
  }
  
  .toast {
    background: linear-gradient(135deg, #2a2a2a, #1f1f1f);
    color: #e0e0e0;
    
    .toast-content .toast-title {
      color: #e0e0e0;
    }
  }
} 